package org.hackystat.devcathlon.ui.page.matches.browse;

import static org.junit.Assert.assertNull;
import org.apache.wicket.util.tester.FormTester;
import org.apache.wicket.util.tester.WicketTester;
import org.hackystat.devcathlon.configuration.ConfigurationException;
import org.hackystat.devcathlon.engine.test.DevcathlonTestHelper;
import org.hackystat.devcathlon.ui.DevcathlonApplication;
import org.hackystat.devcathlon.ui.page.login.LoginPage;
import org.junit.Test;
import org.junit.Ignore;

/**
 * Tests BrowsePage.
 *
 * @author John Zhou
 */
public class TestBrowsePage extends DevcathlonTestHelper {
  /**
   * Test BrowsePage.
   * 
   * @throws ConfigurationException Unexpected error. 
   */
  @Ignore @Test
  public void testPage() throws ConfigurationException {
    WicketTester tester = new WicketTester(new DevcathlonApplication());
    tester.startPage(BrowsePage.class);
    tester.assertRenderedPage(LoginPage.class);
    
    FormTester formTester = tester.newFormTester("loginForm");
    formTester.setValue("user", "admin@hackystat.org");
    formTester.setValue("password", "admin@hackystat.org");
    formTester.submit();
    
    tester.assertRenderedPage(BrowsePage.class);
    assertNull("wicket ID form should not be found.", tester.getTagByWicketId("asdasd"));
  }
}
